﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace QL_BenXe
{
    public partial class frm_SearchNhanVien : Form
    {
        public frm_SearchNhanVien()
        {
            InitializeComponent();
        }

        private void frm_SearchNhanVien_Load(object sender, EventArgs e)
        {
            cmb_ChucVu.DisplayMember = "TenChucVu";
            cmb_ChucVu.ValueMember = "MaChucVu";
            cmb_ChucVu.DataSource = ChucVuBUS.Select_All();
            dateTimePicker1.Value = DateTime.Parse("1/1/1990");
        }

        private void btn_Search_Click(object sender, EventArgs e)
        {
            dtg_NhanVien.AutoGenerateColumns = false;
            NhanVien emp = new NhanVien();
            emp.TenNhanVien = txt_TenNV.Text;
            emp.CMND = txt_CMND.Text;
            emp.NgaySinh = dateTimePicker1.Value.ToShortDateString();
            if (radioButton1.Checked)
                emp.GioiTinh = "1";
            else
                emp.GioiTinh = "0";
            emp.DienThoai = txt_DienThoai.Text; 
            emp.DiaChi = txt_DiaChi.Text;
            emp.TenChucVu = cmb_ChucVu.Text;
            List<NhanVien> list = NhanVienBUS.Search(emp);
            if (list.Count != 0)
                dtg_NhanVien.DataSource = list;
            else
                MessageBox.Show("Không tìm thấy kết quả nào !!!");
        }
    }
}
